package com.itany.thread.test02;

public class WaitThread extends Thread{
	private Object obj;
	public WaitThread(Object obj) {
		this.obj = obj;
	}
	@Override
	public void run() {
		synchronized (obj) {
			System.out.println(getName()+"释放锁,即将进入等待池...");
			try {
				// 设置线程等待时间,单位:毫秒
//				obj.wait(2000);
				obj.wait();
//				Thread.sleep(10000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		System.out.println(getName()+"执行完成");
	}
}
